package com.hzbank.qwencode.config;

import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * QwenCode 配置类
 * 集中管理所有配置变量，便于统一修改和维护
 */
@Configuration
@Getter
public class QwencodeConfig {

    // ===== 服务配置 =====
    @Value("${qwencode.port:8001}")
    private int defaultPort;

    @Value("${qwencode.api.url:http://localhost:8001}")
    private String defaultApiUrl;

    // ===== 超时配置 =====
    @Value("${qwencode.timeout.client:120}")
    private int clientTimeout;

    @Value("${qwencode.timeout.command-execution:120}")
    private int commandExecutionTimeout;

    @Value("${qwencode.timeout.command-validation:10}")
    private int commandValidationTimeout;

    @Value("${qwencode.timeout.health-check:5}")
    private int healthCheckTimeout;

    // ===== 流式处理配置 =====
    @Value("${qwencode.stream.chunk-size:100}")
    private int streamChunkSize;

    @Value("${qwencode.stream.delay:0.1}")
    private double streamSimulationDelay;

    // ===== 命令配置 =====
    @Value("${qwencode.command.name:qwen}")
    private String qwenCommand;

    @Value("#{T(java.util.Arrays).asList('${qwencode.command.args:-y}')}")
    private String[] qwenCommandArgs;

    // ===== 临时文件配置 =====
    @Value("${qwencode.temp.file-prefix:qwencode_tmp_}")
    private String tempFilePrefix;

    // ===== Windows特定配置 =====
    @Value("${qwencode.windows.codepage:65001}")
    private String windowsCodepage;

    // ===== 错误信息配置 =====
    @Value("${qwencode.error.timeout-message:错误：qwen命令执行超时。这可能是由于网络连接问题或命令需要较长时间才能完成。请稍后重试，或者检查命令是否正常工作。}")
    private String timeoutErrorMessage;

    // ===== 日志配置 =====
    @Value("${qwencode.debug.enabled:true}")
    private boolean enableDebugLogging;

}